﻿using System.Collections.ObjectModel;
using System.Xml.Serialization;

namespace RK.Store.MetroSnake.Data
{
    [XmlType]
    public class GameDataContainer
    {
        public const int GAME_SCORE_MAX = 20;

        private ObservableCollection<GameScore> m_gameScores;

        /// <summary>
        /// Initializes a new instance of the <see cref="GameDataContainer" /> class.
        /// </summary>
        public GameDataContainer()
        {
            m_gameScores = new ObservableCollection<GameScore>();
            m_gameScores.CollectionChanged += (sender, eArgs) =>
            {
                int actScoreIndex = 1;
                foreach (var actItem in m_gameScores)
                {
                    actItem.ScoreIndex = actScoreIndex;
                    actScoreIndex++;
                }
            };
        }

        /// <summary>
        /// Gets a list containing all game scores.
        /// </summary>
        [XmlElement("GameScore")]
        public ObservableCollection<GameScore> GameScores
        {
            get { return m_gameScores; }
        }
    }
}